#include <iostream>
#include <fstream>
#include <complex>

using namespace std;

/* run out.m first to get data */

void nonref(int* p1, int* p2){
  p1 = p2; 
}

void ref(int*& p1, int*& p2){
  p1 = p2; 
}

int main(int argc, char ** argv){
  int *p1, *p2;
  p2 = new int;
  *p2 = 2;
  nonref(p1, p2);
  cerr << "(nonref)*p1 == " << *p1 << endl;
  ref(p1,p2);
  cerr << "(ref)*p1 == " << *p1 << endl;
  delete[] p2;
  return 1;
}
